package com.gperp.controller;

import java.util.List;

import org.apache.http.HttpRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gperp.pojo.HatArea;
import com.gperp.pojo.HatCity;
import com.gperp.pojo.HatProvince;
import com.gperp.pojo.HatProvinceExample;
import com.gperp.service.HatAreaService;
import com.gperp.service.HatCityService;
import com.gperp.service.HatProvinceService;

@RequestMapping("city")
@Controller
public class PrinCityController {

	@Autowired
	private HatAreaService hatAreaService;
	@Autowired
	private HatCityService hatCityService;
	@Autowired
	private HatProvinceService hatProvinceService;
	
	@RequestMapping(value="getProvinces",method=RequestMethod.GET)
	@CrossOrigin
	@ResponseBody
	public List<HatProvince> getProvince(HatProvinceExample example){
		List<HatProvince> list = hatProvinceService.getProvince(example);
		return list;
	}
	@RequestMapping(value="getCity",method=RequestMethod.POST)
	@CrossOrigin
	@ResponseBody
	public List<HatCity> getCity(String father){
		List<HatCity> list = hatCityService.getCity(father);
		return list;
	}
	@RequestMapping(value="getArea",method=RequestMethod.POST)
	@CrossOrigin
	@ResponseBody
	public List<HatArea> getArea(String father,String province){
		List<HatArea> list = hatAreaService.getArea(father,province);
		return list;
	}
}
